﻿<!DOCTYPE html>  
<html>  
<head>  
    <meta charset="UTF-8">  
    <title>Basic Layout - jQuery EasyUI Demo</title>  

    <link rel="stylesheet" type="text/css" href="/pfw/jquery/easyui/themes/default/easyui.css">  
    <link rel="stylesheet" type="text/css" href="/pfw/jquery/easyui/themes/icon.css">  
    <link rel="stylesheet" type="text/css" href="/pfw/jquery/easyui/themes/demo/demo.css">  
    <script type="text/javascript" src="/pfw/jquery/jquery-1.9.1.min.js"></script>  
    <script type="text/javascript" src="/pfw/jquery/jquery-migrate-1.1.1.js"></script>
    <script type="text/javascript" src="/pfw/jquery/jquery.form.js"></script>  
    <script type="text/javascript" src="/pfw/jquery/easyui/jquery.easyui.min.js"></script></head>  
    <script type="text/javascript" src="/pfw/jquery/easyui/common/datagrid.js"></script>  
    <script type="text/javascript" src="/pfw/jquery/easyui/common/utils.js"></script>    
    <script type="text/javascript" src="/sysadmin/systemDic/extlistdic.do?isvar=1"></script>
	  <script type="text/javascript" src="/js/dic.js"></script>
	  <script type="text/javascript" src="/sysadmin/systemConstantDic/extlist.do?isvar=1"></script>
    <script type="text/javascript" src="/js/constantDic.js"></script>	    	
    
 <style type="text/css"> 
 	  html { font-size:12px; height:100%;} 
    body {MARGIN: 0px; font-size:12px; height:100%; }
 </style>    
<script type="text/javascript">  
	 <!--
	     
        var url;  
        function newUser(){  
        	alert('aa1');
        	  //$(window.frames["tab_panel_1"].contentWindow.document.getElementById('dg')).datagrid('reload');
        	  //var a1=$(window.frames["tab_panel_1"].contentWindow.document).find('#dg');
        	  //console.log(a1);
        	  //$(a1).datagrid('reload');
        	  //$(window.frames["tab_panel_1"].contentWindow).dgreload('test'); 
        	  //$(window.frames["tab_panel_1"].document).find('#dg').datagrid('reload');
        	  //alert('aa');
        	  //var aa=$(window.frames["tab_panel_1"].document).find('#dg');
        	  //console.log(document.frames["tab_panel_1"]);
        	   var a= document.getElementById("tab_panel_1");
        	   a.contentWindow.jobId=123432;
        	   a.contentWindow.dgreload('test');
        	   alert(a.contentWindow.jobId);
        	  //window.frames["tab_panel_1"].contentWindow.dgreload('test');
        	  //tab_panel11.dgreload('test');
        	  //console.log(window.frames["tab_panel_1"]);
        	  //console.log(document.frames("tab_panel11"));
        	  //document.frames("tab_panel11").dgreload('test');
        	  //window.frames["tab_panel_1"].dgreload('test');
        	  //$(aa).datagrid('reload');
        	  return ;
            $('#dlg').dialog('open').dialog('setTitle','New User');  
            $('#fm').form('clear');  
            url = 'save_user.php';  
        }  
          
        function formatPrice(val,row){  
            //console.log(val);
            //return row.account;  
            return val;
           
        } 
        function getConstantDic(val,row,index){  
            console.log(val);
            return __getConstantCategroyCodeValue('UserStatus', val);
            //return row.account;  
            
            //return val;
           
        }
      
        function editUser(){  
        	 $('#combobox1').combobox('setValues', [2302,2305]);
            var row = $('#dg').datagrid('getSelected'); 
            console.log(row); 
            if (row){  
                $('#dlg').dialog('open').dialog('setTitle','Edit User');  
                $('#fm').form('load',row);  
                url = 'update_user.php?id='+row.id;  
            }  
        }  
         
        function saveUser(){  
            $('#fm').form('submit',{  
                url: url,  
                onSubmit: function(){  
                    return $(this).form('validate');  
                },  
                success: function(result){  
                    var result = eval('('+result+')');  
                    if (result.errorMsg){  
                        $.messager.show({  
                            title: 'Error',  
                            msg: result.errorMsg  
                        });  
                    } else {  
                        $('#dlg').dialog('close');      // close the dialog  
                        $('#dg').datagrid('reload');    // reload the user data  
                    }  
                }  
            });  
        }  
        function destroyUser(){  
            var row = $('#dg').datagrid('getSelected');  
            if (row){  
                $.messager.confirm('Confirm','Are you sure you want to destroy this user?',function(r){  
                    if (r){  
                        $.post('destroy_user.php',{id:row.id},function(result){  
                            if (result.success){  
                                $('#dg').datagrid('reload');    // reload the user data  
                            } else {  
                                $.messager.show({   // show error message  
                                    title: 'Error',  
                                    msg: result.errorMsg  
                                });  
                            }  
                        },'json');  
                    }  
                });  
            }  
        }  
        

     -->
         
    </script>    
    
<body>  
  
    <div class="easyui-layout" align=center style="width:100%;height:590px;overflow:hidden">  
    	
    	 <!---上面区域(开始)--->
        <div data-options="region:'north',split:true" style="width:800px;height:350px">  
           
           <table id="dg" title="My Users" class="easyui-datagrid" 
            url="/auth/systemUser/jsonlist.do"  
            toolbar="#toolbar" pagination="true"  
            rownumbers="true" fitColumns="true" singleSelect="false">  
                  <thead>  
                      <tr>  
                          <th data-options="field:'ck',checkbox:true"></th>
                          <th field="name" width="50">name</th>  
                          <th field="account" width="50">account</th>  
                          <th field="phone" width="50">Phone</th>  
                          <th field="email" width="50">Email</th>  
                          <th field="status" width="50">Status</th>  
              
                      </tr>  
                  </thead>  
           </table>  
           
           <div id="toolbar">  
               <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="newUser()">New User</a>  
               <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="editUser()">Edit User</a>  
               <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="destroyUser()">Remove User</a>  
           </div>  
           <!---新增form(开始) --->  
           <div id="dlg" class="easyui-dialog" style="width:400px;height:280px;padding:10px 20px"  
                   closed="true" buttons="#dlg-buttons">  
               <div class="ftitle">User Information</div>  
               <form id="fm" method="post" novalidate>  
                   <div class="fitem">  
                       <label>First Name:</label>  
                       <input name="firstname" class="easyui-validatebox" required="true">  
                   </div>  
                   <div class="fitem">  
                       <label>Last Name:</label>  
                       <input name="lastname" class="easyui-validatebox" required="true">  
                   </div>  
                   <div class="fitem">  
                       <label>Phone:</label>  
                       <input name="phone">  
                   </div>  
                   <div class="fitem">  
                       <label>Email:</label>  
                       <input name="email" class="easyui-validatebox" validType="email">  
                   </div>  
               </form>  
           </div>  
           <!---新增form(结束) --->  
           <div id="dlg-buttons">  
               <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveUser()">Save</a>  
               <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')">Cancel</a>  
           </div> 
           
        </div>
       <!---上面区域(结束)--->
            
        <!---下面区域(开始)--->
        <div data-options="region:'center',iconCls:'icon-ok'" style="width:100%">  
            <div id="tab_panel" class="easyui-tabs" style="width:1200px;height:230px">  
                <div title="About" style="padding:10px">  
                    <iframe id="tab_panel_1" name="tab_panel11" src="/test1.html" style="width:100%;height:80%"></iframe>  
                </div>  
                <div title="My Documents" style="padding:10px">  
                  
                </div>  
                <div title="Help" data-options="iconCls:'icon-help',closable:true" style="padding:10px">  
                    This is the help content.  
                 </div>  
            </div>  
        </div>  
        <!---下面区域(结束)--->
        
    </div>  
 
<style type="text/css">  
        #fm{  
            margin:0;  
            padding:10px 30px;  
        }  
        .ftitle{  
            font-size:14px;  
            font-weight:bold;  
            padding:5px 0;  
            margin-bottom:10px;  
            border-bottom:1px solid #ccc;  
        }  
        .fitem{  
            margin-bottom:5px;  
        }  
        .fitem label{  
            display:inline-block;  
            width:80px;  
        }  
    </style> 
    
    <script type="text/javascript">  
     	  
        //设置

     	  $('#dg').datagrid({
        	    onClickRow: function(rowIndex, rowData){
        	    	//alert('onClickRow:'+rowData.name);              
        	    	var detail= document.getElementById("tab_panel_1");
        	      //a.contentWindow.jobId=123432;
        	      detail.contentWindow.dgreload(rowData.id);
        	    }
        });

       

     </script>
</body>  
</html>
